//导航栏
$(function () {
    $.ajax({
        type: "POST",
        url: "/user/getUserSession.do",
        dataType: "text",
        cache: false,
        success: function (result) {
            if (result === "" || result == null) {
                $('#user_session').append("<div class='nev-compo'><ul><li class='nev-items'><a href='/pages/user/login.html'>登录</a></li></ul></div>&nbsp;");
            } else {
                result = JSON.parse(result);
                $('#user_session').append("" +
                    "<div class='nev-compo'>\n" +
                    "    <ul>\n" +
                    "        <li class='nev-items'><a href='/user/quitUser.do'>退出登录</a></li>\n" +
                    "        <li class='nev-items'>" + result.name + "</li>\n" +
                    "    </ul>\n" +
                    "</div>" +
                    "");
                /*<div class='nev-compo'>
                    <ul>
                        <li class='nev-items'><a href=''>我的曲谱</a></li>
                        <li class='nev-items'><a href=''>用户名</a></li>
                        //推荐使用用户头像作为用户个人页面的链接
                    </ul>
                </div>*/
            }

        }, //如果用户已经登陆，获取用户信息放于导航栏
        error: function () {
            $('#user_session').append("<div class='nev-compo'><ul><li class='nev-items'><a href='/pages/user/login.html'>登录</a></li></ul></div>&nbsp;");
        }
    });

});

